package service

import (
	"guliedu/model"
	"guliedu/repository"
)

type IStatisticsDailyService interface {
	Insert(daily *model.StatisticsDaily) error
	Update(daily *model.StatisticsDaily) error
	Select(date string) (*model.StatisticsDaily, error)
	SelectByType(date []string) ([]model.StatisticsDaily, error)
}

func NewIStatisticsDailyService() IStatisticsDailyService {
	return &StatisticsDailyService{StatisticsDailyRepository: repository.NewIStatisticsDailyRepository()}
}

type StatisticsDailyService struct {
	StatisticsDailyRepository repository.IStatisticsDailyRepository
}

func (t *StatisticsDailyService) Insert(daily *model.StatisticsDaily) error {
	return t.StatisticsDailyRepository.Insert(daily)
}

func (t *StatisticsDailyService) Update(daily *model.StatisticsDaily) error {
	return t.StatisticsDailyRepository.Update(daily)
}

func (t *StatisticsDailyService) Select(date string) (*model.StatisticsDaily, error) {
	return t.StatisticsDailyRepository.Select(date)
}

func (t *StatisticsDailyService) SelectByType(date []string) ([]model.StatisticsDaily, error) {
	return t.StatisticsDailyRepository.SelectByType(date)
}
